<template>
  <div id="app">
    <ul>
      <li v-for="(item, index) in arr" :key="index">
        <span>{{item}}</span>
        <button @click="remove(index)">删除</button>
      </li>
    </ul>
    <button @click="create">生成</button>
  </div>
</template>

<script>
export default {
  name: 'TaskOneDemoApp',

  data() {
    return {
      arr:[1,5,3],
    };
  },

  mounted() {
    
  },

  methods: {
    create(){
      let i=Math.round(Math.random()*9)
      this.arr.push(i)
    },
    remove(e){
      /* console.log(e); */
      this.arr.splice(e,1)
    }
  },
};
</script>

<style lang="scss" scoped>

</style>